- Courses
- ItemPath API
- Section 4: Essential Calls
- Creating Orders & Order Lines
- Adding a New Order (POST)
Adding a New Order (POST)
To create an order, "name" (the order name or number) is required in the body of the request. Other order body params are optional. A unique ID for the order will be generated automatically.
The order also needs to have at least one order line, which requires a material and a quantity. As you look through other order lines body params, note that the orderId is only required when creating order lines for an order that already exists.
Direction Types
Determine the type of order by setting the "directionType". The values for this key are listed in this data table.
Take a look at the API Reference for more attributes.
Try creating this example of a pick order using the ID of the material you created earlier. Keep in mind that orders need unique order names, so you'll need to change the order name if you try this multiple times.
Tip: If you'll be using using serial numbers, try adding one to the order line. Materials with serial numbers cannot have a quantity of more than 1.
Body of the request:
{
"name": "Test Pick Order",
"directionType": 2,
"order_lines": [
{
"materialId": "[the ID of the material you created earlier]",
"quantity": 1,
"lotNumber": "Lot12"
}
],
"Info1": "This order is for testing."
}
You should see a response something like this:
{
"order": {
"unit": null,
"modifiedDate": "2022-03-22T20:41:56.220000",
"storageUnits": [],
"id": "068119BB-C482-4346-833E-0FA207FBA525",
"name": "Test Pick Order",
"warehouseName": "[your warehouse name]",
"priority": 2,
"order_lines": [
{
"lot": "Lot12",
"quantityConfirmed": 0.0,
"modifiedDate": "2022-03-22T20:41:56.357000",
"materialName": "Renamed Sample Material",
"id": "BE2059B6-C69C-45C0-A081-B56C1D902FCB",
"quantity": 1.0,
"quantityDeviated": 1.0,
"quantityRequested": 0.0,
"serialNumber": null,
"number": 1
},
],
"deadline": null,
"Info1": "This order is for testing.",
"Info2": null,
"status": "Untouched",
"type": 1,
"Info3": null,
"incompleteAllocations": 0,
"hasStock": 0,
"Info5": null,
"Info4": null,
"directionType": 2,
"handlingUnit": null
}
}
Copy the ID of the order you just created.
You can also try creating a put order using the example below, or try using your own values for the various keys.
{
"name": "Test Put Order",
"directionType": 1,
"order_lines": [
{
"materialId": "[the ID of the material you created earlier]",
"quantity": 20,
}
],
"Info1": "This order is for testing."
}
Order Status Types
An order's status is automatically set to "Untouched" when it is created, but these values can be helpful when searching for the status of an order, if it's in process. All order status types and their descriptions are listed in this data table.